package redisService

import (
	"log"
	"time"
)

func SetStr(key string, value interface{}, second time.Duration) bool {
	statusCmd := rdb.Set(key, value, second*time.Second)
	if err := statusCmd.Err(); err != nil {
		log.Printf("redis set string 失败 err: %v \n", err)
		return false
	}
	return true
}

func GetStr(key string) (string, error) {
	stringCmd := rdb.Get(key)
	if err := stringCmd.Err(); err != nil {
		log.Printf("redis get string 失败 err: %v \n", err)
		return "", err
	}
	return stringCmd.Val(), nil
}
